package com.itheima.demo2;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Demo {
    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException {
        Student student = new Student("zhangsan",18);
        Class<? extends Student> aClass = student.getClass();

        Method showInfo = aClass.getDeclaredMethod("showInfo");
        Student student1 = aClass.newInstance();

        showInfo.invoke(student);
    }
}
